home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / BasicLookAndFeel.java < prev    next >
Text File  |  1998-06-30  |  33KB  |  813 lines

  1. /*
  2.  * @(#)BasicLookAndFeel.java    1.106 98/04/14
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.basic;
  22.  
  23. import java.awt.Font;
  24. import java.awt.Color;
  25. import java.awt.SystemColor;
  26. import java.awt.event.KeyEvent;
  27. import java.net.URL;
  28. import java.io.Serializable;
  29.  
  30. import com.sun.java.swing.LookAndFeel;
  31. import com.sun.java.swing.BorderFactory;
  32. import com.sun.java.swing.JComponent;
  33. import com.sun.java.swing.ImageIcon;
  34. import com.sun.java.swing.UIDefaults;
  35. import com.sun.java.swing.UIManager;
  36. import com.sun.java.swing.KeyStroke;
  37. import com.sun.java.swing.JTextField;
  38. import com.sun.java.swing.border.*;
  39. import com.sun.java.swing.plaf.*;
  40. import com.sun.java.swing.text.JTextComponent;
  41. import com.sun.java.swing.text.DefaultEditorKit;
  42.  
  43. /**
  44.  * Implements the a standard base LookAndFeel class from which
  45.  * standard desktop LookAndFeel classes (JLF, Mac, Windows, etc.)
  46.  * can be derived.  This class cannot be instantiated directly,
  47.  * however the UI classes "Basic" defines can be.
  48.  * <p>
  49.  * Warning: serialized objects of this class will not be compatible with
  50.  * future swing releases.  The current serialization support is appropriate 
  51.  * for short term storage or RMI between Swing1.0 applications.  It will
  52.  * not be possible to load serialized Swing1.0 objects with future releases
  53.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  54.  * baseline for the serialized form of Swing objects.
  55.  *
  56.  * @version 1.106 04/14/98
  57.  * @author unknown
  58.  */
  59. public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable
  60. {
  61.  
  62.     public UIDefaults getDefaults() {
  63.     UIDefaults table = new UIDefaults();
  64.  
  65.     initClassDefaults(table);
  66.     initSystemColorDefaults(table);
  67.     initComponentDefaults(table);
  68.  
  69.     return table;
  70.     }
  71.  
  72.     /** 
  73.      * Initialize the uiClassID to BasicComponentUI mapping.
  74.      * The JComponent classes define their own uiClassID constants
  75.      * (see AbstractComponent.getUIClassID).  This table must
  76.      * map those constants to a BasicComponentUI class of the
  77.      * appropriate type.
  78.      * 
  79.      * @see #getDefaults
  80.      */
  81.     protected void initClassDefaults(UIDefaults table)
  82.     {
  83.     String basicPackageName = "com.sun.java.swing.plaf.basic.";
  84.     Object[] uiDefaults = {
  85.            "ButtonUI", basicPackageName + "BasicButtonUI",
  86.          "CheckBoxUI", basicPackageName + "BasicCheckBoxUI",
  87.              "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
  88.           "MenuBarUI", basicPackageName + "BasicMenuBarUI",
  89.              "MenuUI", basicPackageName + "BasicMenuUI",
  90.          "MenuItemUI", basicPackageName + "BasicMenuItemUI",
  91.      "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI",
  92.       "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI",
  93.           "RadioButtonUI", basicPackageName + "BasicRadioButtonUI",
  94.          "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI",
  95.         "PopupMenuUI", basicPackageName + "BasicPopupMenuUI",
  96.           "ProgressBarUI", basicPackageName + "BasicProgressBarUI",
  97.         "ScrollBarUI", basicPackageName + "BasicScrollBarUI",
  98.            "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI",
  99.         "SplitPaneUI", basicPackageName + "BasicSplitPaneUI",
  100.            "SliderUI", basicPackageName + "BasicSliderUI",
  101.           "SpinnerUI", basicPackageName + "BasicSpinnerUI",
  102.         "SeparatorUI", basicPackageName + "BasicSeparatorUI",
  103.            "TabbedPaneUI", basicPackageName + "BasicTabbedPaneUI",
  104.          "TextAreaUI", basicPackageName + "BasicTextAreaUI",
  105.         "TextFieldUI", basicPackageName + "BasicTextFieldUI",
  106.         "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI",
  107.          "TextPaneUI", basicPackageName + "BasicTextPaneUI",
  108.                "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
  109.              "TreeUI", basicPackageName + "BasicTreeUI",
  110.             "LabelUI", basicPackageName + "BasicLabelUI",
  111.              "ListUI", basicPackageName + "BasicListUI",
  112.           "ToolBarUI", basicPackageName + "BasicToolBarUI",
  113.           "ToolTipUI", basicPackageName + "BasicToolTipUI",
  114.          "ComboBoxUI", basicPackageName + "BasicComboBoxUI",
  115.             "TableUI", basicPackageName + "BasicTableUI",
  116.           "TableHeaderUI", basicPackageName + "BasicTableHeaderUI",
  117.         "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
  118.        "StandardDialogUI", basicPackageName + "BasicStandardDialogUI",
  119.           "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
  120.           "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
  121.            "OptionPaneUI", basicPackageName + "BasicOptionPaneUI"
  122.     };
  123.  
  124.     table.putDefaults(uiDefaults);
  125.     }
  126.  
  127.     /**
  128.      * Load the SystemColors into the defaults table.  The keys
  129.      * for SystemColor defaults are the same as the names of
  130.      * the public fields in SystemColor.  If the table is being
  131.      * created on a native Windows platform we use the SystemColor
  132.      * values, otherwise we create color objects whose values match
  133.      * the defaults Windows95 colors.
  134.      */
  135.     protected void initSystemColorDefaults(UIDefaults table)
  136.     {
  137.     String[] systemColors = {
  138.               "desktop", "#005C5C", /* Color of the desktop background */
  139.       "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
  140.       "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
  141.     "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
  142.         "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
  143.     "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
  144.   "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
  145.              "window", "#FFFFFF", /* Default color for the interior of windows */
  146.        "windowBorder", "#000000", /* ??? */
  147.          "windowText", "#000000", /* ??? */
  148.            "menu", "#C0C0C0", /* Background color for menus */
  149.            "menuText", "#000000", /* Text color for menus  */
  150.            "text", "#C0C0C0", /* Text background color */
  151.            "textText", "#000000", /* Text foreground color */
  152.       "textHighlight", "#000080", /* Text background color when selected */
  153.       "textHighlightText", "#FFFFFF", /* Text color when selected */
  154.        "textInactiveText", "#808080", /* Text color when disabled */
  155.             "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
  156.         "controlText", "#000000", /* Default color for text in controls */
  157.        "controlHighlight", "#FFFFFF", /* Specular highlight (opposite of the shadow) */
  158.      "controlLtHighlight", "#E0E0E0", /* Highlight color for controls */
  159.       "controlShadow", "#808080", /* Shadow color for controls */
  160.         "controlDkShadow", "#000000", /* Dark shadow color for controls */
  161.           "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
  162.            "info", "#FFFFE1", /* ??? */
  163.            "infoText", "#000000"  /* ??? */
  164.     };
  165.  
  166.     loadSystemColors(table, systemColors);
  167.     }
  168.  
  169.  
  170.     /**
  171.      * If this is the native look and feel the initial values for the
  172.      * system color properties are the same as the SystemColor constants.
  173.      * If not we use the integer color values in the <code>systemColors</code>
  174.      * argument.
  175.      */
  176.     protected void loadSystemColors(UIDefaults table, String[] systemColors)
  177.     {
  178.     /* PENDING(hmuller) We don't load the system colors below because
  179.      * they're not reliable.  Hopefully we'll be able to do better in 
  180.      * a future version of AWT.
  181.      */
  182.     if (false && isNativeLookAndFeel()) {
  183.         for(int i = 0; i < systemColors.length; i += 2) {
  184.         Color color = Color.black;
  185.         try {
  186.             String name = systemColors[i];
  187.             color = (Color)(SystemColor.class.getField(name).get(null));
  188.         } catch (Exception e) { 
  189.         }
  190.         table.put(systemColors[i], new ColorUIResource(color));
  191.         }
  192.     } else {
  193.         for(int i = 0; i < systemColors.length; i += 2) {
  194.         Color color = Color.black;
  195.         try {
  196.             color = Color.decode(systemColors[i + 1]);
  197.         } 
  198.         catch(NumberFormatException e) {
  199.             e.printStackTrace();
  200.         }
  201.         table.put(systemColors[i], new ColorUIResource(color));
  202.         }
  203.     }
  204.     }
  205.  
  206.     
  207.     protected void initComponentDefaults(UIDefaults table) 
  208.     {
  209.     // *** Fonts
  210.     FontUIResource dialogPlain12 = new FontUIResource("Dialog", Font.PLAIN, 12);
  211.     FontUIResource serifPlain12 = new FontUIResource("Serif", Font.PLAIN, 12);
  212.     FontUIResource sansSerifPlain12 = new FontUIResource("SansSerif", Font.PLAIN, 12);
  213.     FontUIResource monospacedPlain12 = new FontUIResource("Monospaced", Font.PLAIN, 12);
  214.     FontUIResource dialogBold12 = new FontUIResource("Dialog", Font.BOLD, 12);
  215.  
  216.     // *** Colors
  217.     ColorUIResource red = new ColorUIResource(Color.red);
  218.     ColorUIResource black = new ColorUIResource(Color.black);
  219.         ColorUIResource white = new ColorUIResource(Color.white);
  220.     ColorUIResource yellow = new ColorUIResource(Color.yellow);
  221.         ColorUIResource gray = new ColorUIResource(Color.gray);
  222.     ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
  223.     ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
  224.     ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224);
  225.     ColorUIResource treeSelection = new ColorUIResource(Color.red);
  226.     ColorUIResource menuItemPressedBackground = new ColorUIResource(0,0,128);
  227.     ColorUIResource menuItemPressedForeground = new ColorUIResource(255,255,255);
  228.  
  229.  
  230.     // *** List 
  231.     Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
  232.         public Object createValue(UIDefaults table) { 
  233.         return new BasicListCellRenderer.UIResource();
  234.         }
  235.     };
  236.  
  237.     // *** ComboBox
  238.         Object comboBoxRendererActiveValue  = new UIDefaults.ActiveValue() {
  239.             public Object createValue(UIDefaults table) {
  240.                 return new BasicComboBoxRenderer.UIResource();
  241.             }
  242.         };
  243.  
  244.         Object comboBoxEditorActiveValue  = new UIDefaults.ActiveValue() {
  245.             public Object createValue(UIDefaults table) {
  246.                 return new BasicComboBoxEditor.UIResource();
  247.             }
  248.         };
  249.  
  250.     // *** ScrollPane
  251.     Object scrollPaneBorder = new UIDefaults.LazyValue() {
  252.         public Object createValue(UIDefaults table) {
  253.         return BorderUIResource.getEtchedBorderUIResource();
  254.         }
  255.     };
  256.  
  257.     Object tableScrollPaneBorder = new BorderUIResource(new BevelBorder(BevelBorder.LOWERED));
  258.  
  259.     // *** FileChooser / FileView
  260.     Object newFolderIcon = new UIDefaults.LazyValue() {
  261.         public Object createValue(UIDefaults table) {
  262.         return LookAndFeel.makeIcon(getClass(), "icons/NewFolder.gif");
  263.         }
  264.     };
  265.  
  266.     Object upFolderIcon = new UIDefaults.LazyValue() {
  267.         public Object createValue(UIDefaults table) {
  268.         return LookAndFeel.makeIcon(getClass(), "icons/UpFolder.gif");
  269.         }
  270.     };
  271.  
  272.     Object homeFolderIcon = new UIDefaults.LazyValue() {
  273.         public Object createValue(UIDefaults table) {
  274.         return LookAndFeel.makeIcon(getClass(), "icons/HomeFolder.gif");
  275.         }
  276.     };
  277.  
  278.     Object detailsViewIcon = new UIDefaults.LazyValue() {
  279.         public Object createValue(UIDefaults table) {
  280.         return LookAndFeel.makeIcon(getClass(), "icons/DetailsView.gif");
  281.         }
  282.     };
  283.  
  284.     Object listViewIcon = new UIDefaults.LazyValue() {
  285.         public Object createValue(UIDefaults table) {
  286.         return LookAndFeel.makeIcon(getClass(), "icons/ListView.gif");
  287.         }
  288.     };
  289.  
  290.     Object directoryIcon = new UIDefaults.LazyValue() {
  291.         public Object createValue(UIDefaults table) {
  292.         return LookAndFeel.makeIcon(getClass(), "icons/Directory.gif");
  293.         }
  294.     };
  295.  
  296.     Object fileIcon = new UIDefaults.LazyValue() {
  297.         public Object createValue(UIDefaults table) {
  298.         return LookAndFeel.makeIcon(getClass(), "icons/File.gif");
  299.         }
  300.     };
  301.  
  302.     Object computerIcon = new UIDefaults.LazyValue() {
  303.         public Object createValue(UIDefaults table) {
  304.         return LookAndFeel.makeIcon(getClass(), "icons/Computer.gif");
  305.         }
  306.     };
  307.  
  308.     Object hardDriveIcon = new UIDefaults.LazyValue() {
  309.         public Object createValue(UIDefaults table) {
  310.         return LookAndFeel.makeIcon(getClass(), "icons/HardDrive.gif");
  311.         }
  312.     };
  313.  
  314.     Object floppyDriveIcon = new UIDefaults.LazyValue() {
  315.         public Object createValue(UIDefaults table) {
  316.         return LookAndFeel.makeIcon(getClass(), "icons/FloppyDrive.gif");
  317.         }
  318.     };
  319.  
  320.  
  321.     // *** Text
  322.     Object multilineTextBorder = new UIDefaults.LazyValue() {
  323.         public Object createValue(UIDefaults table) {
  324.         return BasicMarginBorder.getMarginBorder();
  325.         }
  326.     };
  327.  
  328.     Object fieldTextBorder = new UIDefaults.LazyValue() {
  329.             public Object createValue(UIDefaults table) {
  330.         return new BorderUIResource(new CompoundBorder(
  331.                                             BasicFieldBorder.getFieldBorder(),
  332.                         BasicMarginBorder.getMarginBorder()));
  333.         }
  334.     };
  335.  
  336.     JTextComponent.KeyBinding[] fieldBindings = {
  337.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
  338.                       JTextField.notifyAction)
  339.     };
  340.  
  341.     JTextComponent.KeyBinding[] multilineBindings = {
  342.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0),
  343.                       DefaultEditorKit.upAction),
  344.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
  345.                       DefaultEditorKit.downAction),
  346.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
  347.                       DefaultEditorKit.pageUpAction),
  348.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0),
  349.                       DefaultEditorKit.pageDownAction),
  350.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
  351.                       DefaultEditorKit.insertBreakAction),
  352.         new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0),
  353.                       DefaultEditorKit.insertTabAction)
  354.     };
  355.  
  356.     Object caretBlinkRate = new UIDefaults.LazyValue() {
  357.             public Object createValue(UIDefaults table) {
  358.         return new Integer(500);
  359.         }
  360.     };
  361.  
  362.     // *** ToolTips
  363.         Object toolTipBorder = new UIDefaults.LazyValue() {
  364.             public Object createValue(UIDefaults table) {
  365.                 return BorderUIResource.getBlackLineBorderUIResource();
  366.             }
  367.         };
  368.                        
  369.  
  370.     // *** ProgessBar
  371.     Object progressBarBorder = new BorderUIResource(
  372.         new LineBorder(Color.green, 2));
  373.                        
  374.  
  375.     // *** Buttons
  376.     Object buttonBorder = new UIDefaults.LazyValue() {
  377.       public Object createValue(UIDefaults table) {
  378.         return new BorderUIResource(new CompoundBorder(
  379.                               BasicBorderFactory.getButtonBorder(),
  380.                               BasicMarginBorder.getMarginBorder()));
  381.       }
  382.     };
  383.  
  384.     Object buttonToggleBorder = new UIDefaults.LazyValue() {
  385.       public Object createValue(UIDefaults table) {
  386.         return new BorderUIResource(new CompoundBorder(
  387.                       BasicBorderFactory.getToggleButtonBorder(),
  388.                       BasicMarginBorder.getMarginBorder()));
  389.       }
  390.     };
  391.  
  392.     Object radioButtonBorder = new UIDefaults.LazyValue() {
  393.       public Object createValue(UIDefaults table) {
  394.         return new BorderUIResource(new CompoundBorder(
  395.                       BasicBorderFactory.getRadioButtonBorder(),
  396.                       BasicMarginBorder.getMarginBorder()));
  397.       }
  398.     };
  399.  
  400.     Object internalFrameBorder = new UIDefaults.LazyValue() {
  401.       public Object createValue(UIDefaults table) {
  402.         return new BorderUIResource( BorderFactory.createCompoundBorder(
  403.                 new BevelBorder(BevelBorder.RAISED,
  404.                     BasicGraphicsUtils.control,
  405.                     BasicGraphicsUtils.controlHighlight,
  406.                     BasicGraphicsUtils.controlBlack,
  407.                     BasicGraphicsUtils.controlShadow),
  408.                 BorderFactory.createLineBorder(
  409.                     BasicGraphicsUtils.control, 1)));
  410.       }
  411.     };
  412.  
  413.     Object menuMarginBorder = new UIDefaults.LazyValue() {
  414.         public Object createValue(UIDefaults table) {
  415.         return new BorderUIResource(BasicMarginBorder.getMarginBorder());
  416.         }
  417.     };
  418.       
  419.     Object menuBarBorder = new UIDefaults.LazyValue(){
  420.       public Object createValue(UIDefaults table) {
  421.         return new BorderUIResource(BasicBorderFactory.getMenuBarBorder());
  422.       }
  423.     };
  424.  
  425.     Object popupMenuBorder = new UIDefaults.LazyValue(){
  426.       public Object createValue(UIDefaults table) {
  427.         return new BorderUIResource(BorderFactory.createRaisedBevelBorder());
  428.       }
  429.     };
  430.  
  431.     Object titledBorderBorder = new UIDefaults.LazyValue(){
  432.       public Object createValue(UIDefaults table) {
  433.         return new BorderUIResource(BorderFactory.createEtchedBorder());
  434.       };
  435.     };
  436.  
  437.     Object toolBarBorder = new UIDefaults.LazyValue(){
  438.         public Object createValue(UIDefaults table) {
  439.         return new BorderUIResource(//new CompoundBorder(
  440.                         BorderFactory.createEtchedBorder()//,
  441.                         //BasicMarginBorder.getMarginBorder())
  442.             );
  443.         }
  444.     };
  445.  
  446.     Object selectedColorBorder = new UIDefaults.LazyValue(){
  447.       public Object createValue(UIDefaults table) {
  448.         return new BorderUIResource(BorderFactory.createLoweredBevelBorder());
  449.       };
  450.     };
  451.  
  452.     Object menuItemCheckIcon = new UIDefaults.LazyValue() {
  453.         public Object createValue(UIDefaults table) {
  454.         return BasicIconFactory.getMenuItemCheckIcon();
  455.         }
  456.     };
  457.  
  458.     Object menuItemArrowIcon = new UIDefaults.LazyValue() {
  459.         public Object createValue(UIDefaults table) {
  460.         return BasicIconFactory.getMenuItemArrowIcon();
  461.         }
  462.     };
  463.  
  464.     Object menuArrowIcon = new UIDefaults.LazyValue() {
  465.         public Object createValue(UIDefaults table) {
  466.         return BasicIconFactory.getMenuArrowIcon();
  467.         }
  468.     };
  469.  
  470.     Object checkBoxIcon = new UIDefaults.LazyValue() {
  471.         public Object createValue(UIDefaults table) {
  472.         return BasicIconFactory.getCheckBoxIcon();
  473.         }
  474.     };
  475.  
  476.     Object radioButtonIcon = new UIDefaults.LazyValue() {
  477.         public Object createValue(UIDefaults table) {
  478.         return BasicIconFactory.getRadioButtonIcon();
  479.         }
  480.     };
  481.  
  482.  
  483.     Object checkBoxMenuItemIcon = new UIDefaults.LazyValue() {
  484.         public Object createValue(UIDefaults table) {
  485.         return BasicIconFactory.getCheckBoxMenuItemIcon();
  486.         }
  487.     };
  488.  
  489.     Object radioButtonMenuItemIcon = new UIDefaults.LazyValue() {
  490.         public Object createValue(UIDefaults table) {
  491.         return BasicIconFactory.getRadioButtonMenuItemIcon();
  492.         }
  493.     };
  494.  
  495.     Object optionPaneBorder = new UIDefaults.LazyValue(){
  496.       public Object createValue(UIDefaults table) {
  497.         return new BorderUIResource(new EmptyBorder(10, 10, 12, 10));
  498.       };
  499.     };
  500.  
  501.     // ** for table
  502.     class DimensionUIResource extends java.awt.Dimension implements UIResource {
  503.       DimensionUIResource() { super(); };
  504.       DimensionUIResource(int x, int y) { super(x, y); };
  505.     }
  506.  
  507.     Object cellEditorBorder = new UIDefaults.LazyValue(){
  508.       public Object createValue(UIDefaults table) {
  509.         return new BorderUIResource(LineBorder.createBlackLineBorder());
  510.       };
  511.     };
  512.  
  513.     Object focusCellHighlightBorder = new BorderUIResource( new LineBorder(yellow) );
  514.  
  515.     Object splitPaneBorder = new BorderUIResource ( new BasicSplitPaneUI.SplitBorder(
  516.                                   table.getColor("controlHighlight"),
  517.                                   table.getColor("controlDkShadow") ) );
  518.  
  519.     Object[] defaults = {
  520.         "Desktop.background", table.get("desktop"),
  521.  
  522.         "Panel.background", table.get("control"),
  523.         "Panel.foreground", table.get("textText"),
  524.         "Panel.font", dialogPlain12,
  525.  
  526.         "Button.border", buttonBorder,
  527.         "Button.background", table.get("control"),
  528.         "Button.foreground", table.get("controlText"),
  529.         "Button.focus", table.get("controlText"),
  530.         "Button.font", dialogPlain12,
  531.         "Button.pressed", table.get("control"),
  532.  
  533.         "ToggleButton.border", buttonToggleBorder,
  534.         "ToggleButton.background", table.get("control"),
  535.         "ToggleButton.foreground", table.get("controlText"),
  536.         "ToggleButton.focus", table.get("controlText"),
  537.         "ToggleButton.font", dialogPlain12,
  538.         "ToggleButton.pressed", table.get("control"),
  539.  
  540.         "RadioButton.background", table.get("control"),
  541.         "RadioButton.foreground", table.get("controlText"),
  542.         "RadioButton.font", dialogPlain12,
  543.         "RadioButton.icon", radioButtonIcon,
  544.         "RadioButton.border", radioButtonBorder,
  545.         "RadioButton.focus", black,
  546.  
  547.         "CheckBox.icon", checkBoxIcon,
  548.         "CheckBox.focus", black,
  549.  
  550.         "RadioButtonMenuItem.icon", radioButtonMenuItemIcon,
  551.         "CheckBoxMenuItem.icon", checkBoxMenuItemIcon,
  552.  
  553.         "MenuBar.border", menuBarBorder,
  554.         "MenuBar.background", table.get("menu"),
  555.         "MenuBar.foreground", table.get("menuText"),
  556.         "MenuBar.font", dialogPlain12,
  557.  
  558.         "Menu.border", menuMarginBorder,
  559.         "Menu.font", dialogPlain12,
  560.         "Menu.foreground", table.get("menuText"),
  561.         "Menu.background", table.get("menu"),
  562.         "Menu.pressedForeground", menuItemPressedForeground,
  563.         "Menu.pressedBackground", menuItemPressedBackground,
  564.         "Menu.arrowIcon", menuArrowIcon,
  565.  
  566.         "MenuItem.border", menuMarginBorder,
  567.         "MenuItem.borderPainted", Boolean.FALSE,
  568.         "MenuItem.font", dialogPlain12,
  569.         "MenuItem.foreground", table.get("menuText"),
  570.         "MenuItem.background", table.get("menu"),
  571.         "MenuItem.pressedForeground", menuItemPressedForeground,
  572.         "MenuItem.pressedBackground", menuItemPressedBackground,
  573.         "MenuItem.disabledForeground", null,
  574.         "MenuItem.acceleratorFont", dialogPlain12,
  575.         "MenuItem.acceleratorForeground", table.get("menuText"),
  576.         "MenuItem.acceleratorPressedForeground", menuItemPressedForeground,
  577.         "MenuItem.checkIcon", menuItemCheckIcon,
  578.         "MenuItem.arrowIcon", menuItemArrowIcon,
  579.  
  580.         "PopupMenu.background", table.get("menu"),
  581.         "PopupMenu.border", popupMenuBorder,        
  582.         "PopupMenu.foreground", table.get("menuText"),
  583.         "PopupMenu.font", dialogPlain12,
  584.  
  585.         "Label.font", dialogPlain12,
  586.         "Label.background", table.get("control"),
  587.         "Label.foreground", table.get("controlText"),
  588.         "Label.disabled", white,
  589.         "Label.disabledShadow", table.get("controlShadow"),
  590.  
  591.         "List.selectionBackground", table.get("textHighlight"), 
  592.         "List.selectionForeground", table.get("textHighlightText"),
  593.          "List.background", table.get("window"),
  594.         "List.foreground", table.get("textText"),
  595.         "List.focusCellHighlightBorder", focusCellHighlightBorder,
  596.         "List.font", dialogPlain12,
  597.         "List.cellRenderer", listCellRendererActiveValue,
  598.         "List.border", null,
  599.  
  600.             "ComboBox.renderer", comboBoxRendererActiveValue,
  601.             "ComboBox.editor",   comboBoxEditorActiveValue,
  602.             "ComboBox.background", white/*table.get("text")*/,
  603.             "ComboBox.foreground", black/*table.get("TextText")*/,
  604.             "ComboBox.selectedBackground", table.get("textHighlight"),
  605.             "ComboBox.selectedForeground", table.get("textHighlightText"),
  606.             "ComboBox.font", dialogPlain12,
  607.             "ComboBox.disabledBackground", table.get("control"),
  608.             "ComboBox.disabledForeground", table.get("textInactiveText"),
  609.  
  610.         "FileChooser.acceptAllFileFilterText", new String ("All Files (*.*)"),
  611.             "FileChooser.cancelButtonText", new String("Cancel"),
  612.             "FileChooser.saveButtonText", new String("Save"),
  613.             "FileChooser.openButtonText", new String("Open"),
  614.             "FileChooser.updateButtonText", new String("Update"),
  615.             "FileChooser.helpButtonText", new String("Help"),
  616.  
  617.             "FileChooser.cancelButtonToolTipText", new String("Abort file chooser dialog."),
  618.             "FileChooser.saveButtonToolTipText", new String("Save selected file."),
  619.             "FileChooser.openButtonToolTipText", new String("Open selected file."),
  620.             "FileChooser.updateButtonToolTipText", new String("Update directory listing."),
  621.             "FileChooser.helpButtonToolTipText", new String("FileChooser help."),
  622.  
  623.         "FileChooser.newFolderIcon", newFolderIcon,
  624.             "FileChooser.upFolderIcon", upFolderIcon,
  625.             "FileChooser.homeFolderIcon", homeFolderIcon, 
  626.             "FileChooser.detailsViewIcon", detailsViewIcon,
  627.             "FileChooser.listViewIcon", listViewIcon,
  628.  
  629.             "FileView.directoryIcon", directoryIcon,
  630.             "FileView.fileIcon", fileIcon,
  631.             "FileView.computerIcon", computerIcon,
  632.             "FileView.hardDriveIcon", hardDriveIcon,
  633.             "FileView.floppyDriveIcon", floppyDriveIcon,
  634.  
  635.         "TextField.caretForeground", black,
  636.         "TextField.caretBlinkRate", caretBlinkRate,
  637.         "TextField.inactiveForeground", table.get("textInactiveText"),
  638.         "TextField.selectionBackground", table.get("textHighlight"),
  639.         "TextField.selectionForeground", table.get("textHighlightText"),
  640.         "TextField.background", table.get("window"),
  641.         "TextField.foreground", table.get("textText"),
  642.         "TextField.font", sansSerifPlain12,
  643.         "TextField.border", fieldTextBorder,
  644.         "TextField.keyBindings", fieldBindings,
  645.         
  646.         "PasswordField.caretForeground", black,
  647.         "PasswordField.caretBlinkRate", caretBlinkRate,
  648.         "PasswordField.inactiveForeground", table.get("textInactiveText"),
  649.         "PasswordField.selectionBackground", table.get("textHighlight"),
  650.         "PasswordField.selectionForeground", table.get("textHighlightText"),
  651.         "PasswordField.background", table.get("window"),
  652.         "PasswordField.foreground", table.get("textText"),
  653.         "PasswordField.font", monospacedPlain12,
  654.         "PasswordField.border", fieldTextBorder,
  655.         "PasswordField.keyBindings", fieldBindings,
  656.         
  657.         "TextArea.caretForeground", black,
  658.         "TextArea.caretBlinkRate", caretBlinkRate,
  659.         "TextArea.inactiveForeground", table.get("textInactiveText"),
  660.         "TextArea.selectionBackground", table.get("textHighlight"),
  661.         "TextArea.selectionForeground", table.get("textHighlightText"),
  662.         "TextArea.background", table.get("window"),
  663.         "TextArea.foreground", table.get("textText"),
  664.         "TextArea.font", monospacedPlain12,
  665.         "TextArea.border", multilineTextBorder,
  666.         "TextArea.keyBindings", multilineBindings,
  667.         
  668.         "TextPane.caretForeground", black,
  669.         "TextPane.inactiveForeground", table.get("textInactiveText"),
  670.         "TextPane.selectionBackground", lightGray,
  671.         "TextPane.selectionForeground", table.get("textHighlightText"),
  672.         "TextPane.background", white,
  673.         "TextPane.foreground", table.get("textText"),
  674.         "TextPane.font", serifPlain12,
  675.         "TextPane.border", multilineTextBorder,
  676.         "TextPane.keyBindings", multilineBindings,
  677.         
  678.         "EditorPane.caretForeground", red,
  679.         "EditorPane.inactiveForeground", table.get("textInactiveText"),
  680.         "EditorPane.selectionBackground", lightGray,
  681.         "EditorPane.selectionForeground", table.get("textHighlightText"),
  682.         "EditorPane.background", white,
  683.         "EditorPane.foreground", table.get("textText"),
  684.         "EditorPane.font", serifPlain12,
  685.         "EditorPane.border", multilineTextBorder,
  686.         "EditorPane.keyBindings", multilineBindings,
  687.         
  688.         "ScrollBar.background", scrollBarTrack,
  689.         "ScrollBar.foreground", table.get("control"),
  690.         "ScrollBar.track", scrollBarTrack,
  691.         "ScrollBar.trackHighlight", table.get("controlDkShadow"),
  692.         "ScrollBar.thumb", table.get("control"),
  693.         "ScrollBar.thumbHighlight", table.get("controlHighlight"),
  694.         "ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
  695.         "ScrollBar.thumbLightShadow", table.get("controlShadow"),
  696.         "ScrollBar.border", null,
  697.  
  698.         "ScrollPane.border", scrollPaneBorder,
  699.         "ScrollPane.font", dialogPlain12,
  700.         "ScrollPane.background", table.get("control"),
  701.         "ScrollPane.foreground", table.get("controlText"),
  702.         "ScrollPane.viewportBorder", null,
  703.  
  704.         "Slider.border", null,
  705.         "Slider.foreground", table.get("control"),
  706.         "Slider.background", table.get("control"),
  707.         "Slider.highlight", table.get("controlHighlight"),
  708.         "Slider.shadow", table.get("controlShadow"),
  709.         "Slider.focus", table.get("controlDkShadow"),
  710.  
  711.         "SplitPane.background", table.get("control"),
  712.         "SplitPane.highlight", table.get("controllHighlight"),
  713.         "SplitPane.shadow", table.get("controlShadow"),
  714.         "SplitPane.border", splitPaneBorder,
  715.         "SplitPane.dividerSize", new Integer(5),
  716.  
  717.             "TabbedPane.font", dialogPlain12,
  718.             "TabbedPane.tabBackground", table.get("control"),
  719.             "TabbedPane.tabForeground", table.get("controlText"),
  720.             "TabbedPane.tabHighlight", table.get("controlHighlight"),
  721.             "TabbedPane.tabShadow", table.get("controlShadow"),
  722.             "TabbedPane.tabDarkShadow", table.get("controlDkShadow"),
  723.             "TabbedPane.focus", black,
  724.  
  725.         "Table.font", dialogPlain12,
  726.         "Table.foreground", table.get("controlText"),  // cell text color
  727.         "Table.background", table.get("window"),  // cell background color
  728.         "Table.selectionForeground", table.get("textHighlightText"),
  729.         "Table.selectionBackground", table.get("textHighlight"),
  730.               "Table.gridColor", gray,  // grid line color
  731.         "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  732.         "Table.focusCellBackground", table.get("window"),
  733.         "Table.focusCellForeground", table.get("controlText"),
  734.         "Table.scrollPaneBorder", tableScrollPaneBorder,
  735.  
  736.         "TableHeader.font", dialogPlain12, 
  737.         "TableHeader.foreground", table.get("controlText"), // header text color
  738.         "TableHeader.background", table.get("control"), // header background
  739.         "TableHeader.cellBorder", BorderFactory.createRaisedBevelBorder(),
  740.    
  741.  
  742.             "TitledBorder.font", dialogPlain12,
  743.             "TitledBorder.titleColor", table.get("controlText"),
  744.             "TitledBorder.border", titledBorderBorder,
  745.  
  746.         "ToolBar.border", toolBarBorder,
  747.         "ToolBar.background", table.get("control"),
  748.         "ToolBar.foreground", table.get("controlText"),
  749.         "ToolBar.font", dialogPlain12,
  750.         "ToolBar.dockingColor", table.get("control"),
  751.         "ToolBar.floatingColor", table.get("control"),
  752.         "ToolBar.dockingBorderColor", red, 
  753.         "ToolBar.floatingBorderColor", darkGray,
  754.         
  755.             "ToolTip.font", sansSerifPlain12,
  756.             "ToolTip.border", toolTipBorder,
  757.             "ToolTip.background", table.get("info"),
  758.             "ToolTip.foreground", table.get("infoText"),
  759.  
  760.         "Tree.background", white,
  761.         "Tree.font", dialogPlain12,
  762.         "Tree.hash", gray,
  763.         "Tree.textSelectionColor", white,
  764.         "Tree.textNonSelectionColor", black,
  765.         "Tree.borderSelectionColor", black,
  766.         "Tree.backgroundSelectionColor", treeSelection,
  767.         "Tree.backgroundNonSelectionColor", white,
  768.         "Tree.openIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeOpen.gif"),
  769.         "Tree.closedIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeClosed.gif"),
  770.         "Tree.leafIcon", LookAndFeel.makeIcon(getClass(), "icons/TreeLeaf.gif"),
  771.         "Tree.expandedIcon", null,
  772.         "Tree.collapsedIcon", null,
  773.  
  774.         "ProgressBar.font", dialogPlain12,
  775.         "ProgressBar.foreground",  table.get("textHighlight"), 
  776.         "ProgressBar.background", table.get("control"), 
  777.         "ProgressBar.border", progressBarBorder,
  778.             "ProgressBar.cellLength", new Integer(1),
  779.             "ProgressBar.cellSpacing", new Integer(0),
  780.  
  781.         "OptionPane.font", dialogPlain12,
  782.         "OptionPane.background", table.get("control"),
  783.         "OptionPane.foreground", table.get("controlText"),
  784.         "OptionPane.border", optionPaneBorder,
  785.  
  786.         "OptionPane.errorIcon", LookAndFeel.makeIcon(getClass(), "icons/Error.gif"),
  787.         "OptionPane.informationIcon", LookAndFeel.makeIcon(getClass(), "icons/Inform.gif"),
  788.         "OptionPane.warningIcon", LookAndFeel.makeIcon(getClass(), "icons/Warn.gif"),
  789.         "OptionPane.questionIcon", LookAndFeel.makeIcon(getClass(), "icons/Question.gif"),
  790.  
  791.             "ColorChooser.font", dialogPlain12,
  792.             "ColorChooser.background", table.get("control"),
  793.             "ColorChooser.foreground", table.get("controlText"),
  794.             "ColorChooser.selectedColorBorder", selectedColorBorder,
  795.  
  796.             "InternalFrame.icon", LookAndFeel.makeIcon(getClass(), "icons/JavaCup.gif"),
  797.         "InternalFrame.border", internalFrameBorder,
  798.             "InternalFrame.titleFont", dialogBold12,
  799.  
  800.             // Default frame icons are undefined for Basic.
  801.             "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(),
  802.             "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(),
  803.             "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(),
  804.             "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(),
  805.  
  806.         "DesktopIcon.border", null
  807.     };
  808.  
  809.     table.putDefaults(defaults);
  810.     }
  811.  
  812. }
  813.